<%@page language="java" contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"
import="java.util.*"%>
<%@page import="bean.*"%>
<%@page import="service.*"%>
<%@page import="DAO.*"%>
<%@page import="servlet.*"%>



<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>


<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
     <style type="text/css">
     a:link {color: black}          /* 未访问的链接 */
     a:link {text-decoration: none;}     /* 去掉下划线 */
     a:visited {color: black}       /* 已访问的链接 */
     a:hover {color: black}             /* 鼠标移动到链接上 */
     a:active {color:black}         /* 选定的链接 */
    </style>
        <script>
   	function fun(val){
   		var r=confirm("确认删除吗？");
   		if(r){
   			location.href="OperatorServlet?op=del&id="+val;
   		}
   	}
   </script>


    </head>
     <body >
        <form >
        
        <h3 align="center">宠物信息</h3>
        <br>
        
        <table border="1" align="center" style="position:relative" width=600 height=200
        cellpadding=0 cellspacing=0>  <!-- 表格透明 -->
            
            <tr>
                <th align="center">宠物编号</th>
                <th align="center">宠物姓名</th>
                <th align="center">宠物种类</th>
                <th align="center">宠物生日</th>  
                <th align="center">宠物主人</th>  
                 <th align="center">更新按钮</th> 
                 <th align="center">删除按钮</th>  
            </tr>
    
      <%
      request.setCharacterEncoding("utf-8");
      response.setContentType("text/html;charset=utf-8");
      
      int id =Integer.parseInt(request.getParameter("id"));
     
      Petbean p = new Petbean();
      p.setId(id);
      
      IPetDao dao = DaoFactory.getProductDao();
      p=dao.queryById(p);
    		%>
    		<tr>
    			<td><%=p.getId()   %></td>
    			<td><%=p.getName() %></td>
    			<td><%=p.getType()  %></td>
    			<td><%=p.getBirthday() %></td>
    			<td><%=p.getOwn_name() %></td>
    			<td><a href="更新宠物.jsp?id=<%=p.getId()%>&op=update">更新</a></td>
    			<td><a href="javascript:void(0);" onclick="fun(<%=p.getId() %>)">删除</a></td>
    		</tr>
    		<%
    		%>

       
      </table>
    </form>
    </body>
</html>
